package com.www.jpa.control;

import com.www.jpa.service.UserServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.sql.SQLException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("user")
@Api(tags = "用户相关接口")
public class UserControl {

    @Autowired
    UserServiceImpl userService;

    @ApiOperation("jdbc批量插入")
    @PostMapping("/test_jdbc")
    public void testJ (int count) {
        try {
            userService.jdbcBatchInsert(count);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    @ApiOperation("jdbc批量修改")
    @PostMapping("/test_jdbc_update")
    public void testUpdate (int count) {
        try {
            userService.jdbcBatchUpdate(count);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
